<template>
	<view>
		<watermark></watermark>
		<view style="margin: 30rpx; border-bottom: 1px solid #ddd;padding-bottom: 20rpx;">
			<view style="float: left; width: 100rpx;height:100rpx;"><image style="width: 100%;height:100%;" :src="noticeMember.notice_portrait" mode="aspectFill"></image></view>
			<view style="float: left;margin-left: 20rpx;">
				<view style="height: 60rpx;line-height: 60rpx;font-size: 32rpx;">{{noticeMember.notice_nickname}}</view>
				<view style="height: 40rpx;line-height: 40rpx;font-size: 24rpx;">{{noticeMember.notice_time}}</view>
			</view>
			<view style="clear: both;"></view>
		</view>
		<view style="margin: 0 30rpx 20rpx 30rpx;padding: 0 10rpx; font-size: 32rpx;">
			<text>{{notice}}</text>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			groupId: '',
			notice: '',
			noticeMember: [],
			detail: []
		};
	},
	onLoad(e) {
		this.groupId = e.groupId;
	},
	onShow(){
		this.getInfo(this.groupId);
	},
	mounted() {
		this.$fc.setTitleNViewBtns(0,'')
	},
	methods: {
		getInfo(e) {
			this.$http.request({
				url: '/group/getInfo/?id=' + e,
				success: res => {
					if (res.data.code == 200) {
						var detail = res.data.data;
						this.detail = detail;
						this.notice = detail.notice;
						this.noticeMember = detail.noticeMember;
						if(detail.user_type == 'root' || detail.user_type == 'manage'){
							this.$fc.setTitleNViewBtns(0,'编辑');
						}else{
							this.$fc.setTitleNViewBtns(0,'');
						}
					}
				}
			});
		},
	},
	onNavigationBarButtonTap(e) {
		switch (e.index) {
			case 0:
				if(this.detail.user_type == 'root' || this.detail.user_type == 'manage'){
					uni.navigateTo({
						url: 'editGroupNotice?groupId=' + this.detail.groupId + '&notice=' + this.notice + '&back_number=3'
					});
				}else{
					// uni.showToast({
					// 	title: '只有群主及管理员可以编辑群公告',
					// 	icon: 'none'
					// });
				}
				break;
			default:
				break;
		}
	},
};
</script>